FROM php:7.4-fpm

RUN mv /etc/apt/sources.list /etc/apt/sources_bak.list
COPY ../sources.list /etc/apt/

RUN apt-get update
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
RUN docker-php-ext-install -j$(nproc) gd
RUN docker-php-ext-install -j$(nproc) pdo_mysql

COPY redis-6.2.0.tgz .
RUN pecl install redis-6.2.0.tgz

RUN docker-php-ext-enable redis
RUN docker-php-ext-install -j$(nproc) bcmath
# RUN echo $HOST_MAPPING >> /etc/hosts
RUN apt-get install -y cmake
RUN apt-get install -y vim

COPY libzip-1.9.2.tar.gz .
RUN tar xvf libzip-1.9.2.tar.gz \
		&& cd libzip-1.9.2 && mkdir build && cd build \
		&& cmake .. && make -j "$(nproc)" && make test && make install \
		&& cd .. && cd .. && rm -r libzip-1.9.2
RUN docker-php-ext-install zip